<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>find_last_of</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">C++ Strings</a> &gt; <a href=
    "find_last_of.html">find_last_of</a>
  </div>

  <div class="name-format">
    find_last_of
  </div>

  <div class="syntax-name-format">
    Syntax:
  </div>
  <pre class="syntax-box">
  #include &lt;string&gt;
  <strong>size_type</strong> find_last_of( const string&amp; str, <strong>size_type</strong> index = npos );
  <strong>size_type</strong> find_last_of( const char* str, <strong>size_type</strong> index = npos );
  <strong>size_type</strong> find_last_of( const char* str, <strong>size_type</strong> index, <strong>size_type</strong> num );
  <strong>size_type</strong> find_last_of( char ch, <strong>size_type</strong> index = npos );
</pre>

  <p>The find_last_of() function either:</p>

  <ul>
    <li>does a reverse search from <em>index</em>, returning the index
    of the first character within the current string that matches any
    character in <em>str</em>, or string::npos if nothing is found,</li>

    <li>does a reverse search in the current string, beginning at
    <em>index</em>, for any of the first <em>num</em> characters in
    <em>str</em>, returning the index in the current string of the
    first character found, or string::npos if no characters
    match,</li>

    <li>or does a reverse search from <em>index</em>, returning the
    index of the first occurrence of <em>ch</em> in the current
    string, string::npos if nothing is found.</li> </ul>

  <div class="related-name-format">
    Related topics:
  </div>

  <div class="related-content">
    <a href="find.html">find</a><br>
    <a href="find_first_not_of.html">find_first_not_of</a><br>
    <a href="find_first_of.html">find_first_of</a><br>
    <a href="find_last_not_of.html">find_last_not_of</a><br>
    <a href="rfind.html">rfind</a>
  </div>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
